home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 8423 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: osf1.gmu.edu!jscheibl
  2. From: jscheibl@osf1.gmu.edu (Jack W Scheible)
  3. Newsgroups: comp.software-eng,comp.unix.solaris,comp.unix.programmer,comp.windows.x,comp.windows.x.motif,comp.lang.c,comp.lang.c++,comp.lang.tcl,comp.object,comp.lang.fortran
  4. Subject: structures as formal parameters
  5. Date: 18 Feb 1996 01:56:18 GMT
  6. Organization: George Mason University, Fairfax, Virginia, USA
  7. Distribution: inet
  8. Message-ID: <4g6102$lql@portal.gmu.edu>
  9. References: <4fut4m$h5t@Dortmund.Germany.EU.net> <31267EED.4874066A@holisticmath.com>
  10. NNTP-Posting-Host: osf1.gmu.edu
  11. Mime-Version: 1.0
  12. Content-Type: text/plain; charset=US-ASCII
  13. Content-Transfer-Encoding: 7bit
  14.  
  15.  
  16. I am trying to pass structures to subroutines.  My problem is that,
  17. when I try to write the interface, it will not recognize previously
  18. declared types.  I can put the type definition into the interface, but
  19. then it is not recognized outside the interface.
  20.  
  21.       PROGRAM JUNK
  22.  
  23.       TYPE CARTESIAN
  24.          REAL*8 X
  25.          REAL*8 Y
  26.       END TYPE CARTESIAN
  27.  
  28.       INTERFACE
  29.          SUBROUTINE CART_TO_POLAR ( XY, RTHETA )
  30.             TYPE POLAR
  31.                REAL*8 R
  32.                REAL*8 THETA
  33.             END TYPE POLAR
  34.             TYPE (CARTESIAN), INTENT(IN) :: XY  ! CARTESIAN Not Declared
  35.             TYPE (POLAR), INTENT(OUT):: RTHETA  ! Just fine
  36.           END SUBROUTINE CART_TO_POLAR
  37.       END INTERFACE
  38.  
  39.       TYPE (CARTESIAN) XY   ! Just fine
  40.       TYPE (POLAR) RTHETA   ! POLAR Not Declared
  41.  
  42.       END
  43.  
  44. Is there any way to use structures in an interface without declaring
  45. the structures twice?
  46.  
  47. -jack
  48.